﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Jicheng
{
  //  1.图形类：
  //求周长，面积（三角形， 四边形， 圆形）

    class Graph
    {
        public double peri;
        public double area;
        public string tape { get; set; }
        public void Getvalue() {
            Console.WriteLine("图形：{0}\n周长：{1}\n面积{2}",tape,peri,area) ;
        }
    }
    class Triangle:Graph
    {

        public double A { get; set; }
        public double B { get; set; }
        public double C { get; set; }

        public void Getperi()
        {
            tape = "三角形";
            peri = A + B + C;
            double p = peri / 2;
            area = Math.Sqrt(p * (p - A) * (p - B) * (p - C));
        }
    }
    class quadrangle : Graph 
    {
        public double Z { get; set; }
        public double K { get; set; }
        public void Getperi()
        {
            tape = "四边形";
            peri = (Z + K) * 2;
            area = Z * K;
        }
    }
    class round : Graph
    {
        public double r { get; set; }

        public double Π = 3.14;
        public void Getperi()
        {
            tape = "圆形";
            peri = 2 * Π * r;
            area = Π * (r * r);
        }
    }
   
}
